﻿﻿﻿﻿/**
 * @name umi 的路由配置
 * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
 * @param path  path 只支持两种占位符配置，第一种是动态参数 :id 的形式，第二种是 * 通配符，通配符只能出现路由字符串的最后。
 * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径，也可以是相对路径，如果是相对路径，会从 src/pages 开始找起。
 * @param routes 配置子路由，通常在需要为多个路径增加 layout 组件时使用。
 * @param redirect 配置路由跳转
 * @param wrappers 配置路由组件的包装组件，通过包装组件可以为当前的路由组件组合进更多的功能。 比如，可以用于路由级别的权限校验
 * @param name 配置路由的标题，默认读取国际化文件 menu.ts 中 menu.xxxx 的值，如配置 name 为 login，则读取 menu.ts 中 menu.login 的取值作为标题
 * @param icon 配置路由的图标，取值参考 https://ant.design/components/icon-cn， 注意去除风格后缀和大小写，如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward，如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
 * @doc https://umijs.org/docs/guides/routes
 */
export default [
  {
    path: '/user',
    layout: false,
    routes: [
      {
        path: '/user/login',
        layout: false,
        name: '登录', // 对应 'menu.login': '登录'
        component: './user/login',
      },
      {
        path: '/user',
        redirect: '/user/login',
      },
      {
        name: '注册结果', // 对应 'menu.register-result': '注册结果'
        icon: 'smile',
        path: '/user/register-result',
        component: './user/register-result',
      },
      {
        name: '注册', // 对应 'menu.register': '注册'
        icon: 'smile',
        path: '/user/register',
        component: './user/register',
      },
      {
        component: '404',
        path: '/user/*',
      },
    ],
  },
  // Dashboard 路由
  {
    path: '/dashboard',
    name: '主页', // 对应 'menu.dashboard': '主页'
    icon: 'dashboard',
    access: 'canViewDashboard',
    routes: [
      {
        path: '/dashboard',
        redirect: '/dashboard/analysis',
      },
      {
        name: '项目主页', // 对应 'menu.dashboard.analysis': '项目主页'
        icon: 'smile',
        path: '/dashboard/analysis',
        component: './dashboard/analysis',
        access: 'canViewDashboardAnalysis',
      },
      {
        name: '监控页', // 对应 'menu.dashboard.monitor': '监控页'
        icon: 'smile',
        path: '/dashboard/monitor',
        component: './dashboard/monitor',
        access: 'canViewDashboardMonitor',
      },
      {
        name: '工作台', // 对应 'menu.dashboard.workplace': '工作台'
        icon: 'smile',
        path: '/dashboard/workplace',
        component: './dashboard/workplace',
        access: 'canViewDashboardWorkplace',
      },
    ],
  },
  {
    path: '/form',
    icon: 'form',
    name: '业财单据', // 对应 'menu.form': '业财单据'
    access: 'canViewForm',
    routes: [
      {
        path: '/form',
        redirect: '/form/basic-form',
      },
      {
        name: '认款单', // 对应 'menu.form.basic-form': '认款单'
        icon: 'smile',
        path: '/form/basic-form',
        component: './form/basic-form',
        access: 'canViewFormBasic',
      },
      {
        name: '收入确认单', // 对应 'menu.form.step-form': '收入确认单'
        icon: 'smile',
        path: '/form/step-form',
        component: './form/step-form',
        access: 'canViewFormStep',
      },
      {
        name: '付款单', // 对应 'menu.form.advanced-form': '付款单'
        icon: 'smile',
        path: '/form/advanced-form',
        component: './form/advanced-form',
        access: 'canViewFormAdvanced',
      },
      {
        name: '业财表单', // 对应 'menu.form.businessFinance-form': '业财表单'
        icon: 'smile',
        path: '/form/businessFinance-form',
        component: './form/businessFinance-form',
        access: 'canViewFormBasic',
      },
    ],
  },
  {
    path: '/list',
    icon: 'table',
    name: '资产核销', // 对应 'menu.list': '资产核销'
    access: 'canViewList',
    routes: [
      {
        path: '/list/search',
        name: '公司库', // 对应 'menu.list.search-list': '公司库'
        component: './list/search',
        routes: [
          {
            path: '/list/search',
            redirect: '/list/search/articles',
          },
          {
            name: '资金（调拨）', // 对应 'menu.list.search-list.articles': '资金（调拨）'
            icon: 'smile',
            path: '/list/search/articles',
            component: './list/search/articles',
          },
          {
            name: '资金（报账）', // 对应 'menu.list.search-list.projects': '资金（报账）'
            icon: 'smile',
            path: '/list/search/projects',
            component: './list/search/projects',
          },
          {
            name: '资金（核销）', // 对应 'menu.list.search-list.applications': '资金（核销）'
            icon: 'smile',
            path: '/list/search/applications',
            component: './list/search/applications',
          },
        ],
      },
      {
        path: '/list',
        redirect: '/list/table-list',
      },
      {
        name: '资金调拨', // 对应 'menu.list.table-list': '资金调拨'
        icon: 'smile',
        path: '/list/table-list',
        component: './table-list',
        access: 'canViewListTable',
      },
      {
        name: '往来核销', // 对应 'menu.list.basic-list': '往来核销'
        icon: 'smile',
        path: '/list/basic-list',
        component: './list/basic-list',
        access: 'canViewListBasic',
      },
      {
        name: '复合池', // 对应 'menu.list.card-list': '复合池'
        icon: 'smile',
        path: '/list/card-list',
        component: './list/card-list',
        access: 'canViewListCard',
      },
    ],
  },
  {
    path: '/profile',
    name: '租赁', // 对应 'menu.profile': '租赁'
    icon: 'profile',
    access: 'canViewProfile',
    routes: [
      {
        path: '/profile',
        redirect: '/profile/basic',
      },
      {
        name: '长期租赁资产登记信息', // 对应 'menu.profile.basic': '长期租赁资产登记信息'
        icon: 'smile',
        path: '/profile/basic',
        component: './profile/basic',
        access: 'canViewProfileBasic',
      },
      {
        name: '长期租赁资产调整信息', // 对应 'menu.profile.advanced': '长期租赁资产调整信息'
        icon: 'smile',
        path: '/profile/advanced',
        component: './profile/advanced',
        access: 'canViewProfileAdvanced',
      },
    ],
  },
  {
    name: '利息计提', // 对应 'menu.result': '利息计提'
    icon: 'CheckCircleOutlined',
    path: '/result',
    access: 'canViewResult',
    routes: [
      {
        path: '/result',
        redirect: '/result/success',
      },
      {
        name: '资产终止记录', // 对应 'menu.result.success': '资产终止记录'
        icon: 'smile',
        path: '/result/success',
        component: './result/success',
      },
      {
        name: '利息计提查询', // 对应 'menu.result.fail': '利息计提查询'
        icon: 'smile',
        path: '/result/fail',
        component: './result/fail',
      },
    ],
  },
  {
    name: '费用类型配置', // 对应 'menu.exception': '费用类型配置'
    icon: 'warning',
    path: '/exception',
    access: 'canViewException',
    routes: [
      {
        path: '/exception',
        redirect: '/exception/403',
      },
      {
        name: '403', // 对应 'menu.exception.403': '403'
        icon: 'smile',
        path: '/exception/403',
        component: './exception/403',
      },
      {
        name: '404', // 对应 'menu.exception.404': '404'
        icon: 'smile',
        path: '/exception/404',
        component: './exception/404',
      },
      {
        name: '500', // 对应 'menu.exception.500': '500'
        icon: 'smile',
        path: '/exception/500',
        component: './exception/500',
      },
    ],
  },
  {
    name: '个人页', // 对应 'menu.account': '个人页'
    icon: 'user',
    path: '/account',
    access: 'canViewAccount',
    routes: [
      {
        path: '/account',
        redirect: '/account/center',
      },
      {
        name: '个人中心', // 对应 'menu.account.center': '个人中心'
        icon: 'smile',
        path: '/account/center',
        component: './account/center',
        access: 'canViewAccountCenter',
      },
      {
        name: '个人设置', // 对应 'menu.account.settings': '个人设置'
        icon: 'smile',
        path: '/account/settings',
        component: './account/settings',
        access: 'canViewAccountSettings',
      },
    ],
  },
  {
    name: '动态路由测试', // 原配置无映射，保留中文名称
    icon: 'experiment',
    path: '/dynamic-routes-demo',
    component: './DynamicRoutesDemo',
  },
  {
    path: '/',
    redirect: '/dashboard/analysis',
  },
  {
    component: '404',
    path: '/*',
  },
]
